﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Ord4a01
    {
		private string _plistid;
		private string _pdlistid;
		private double _bqty;
		private double _accqty;
		private double _price;
		private double _rprice;
		private double _ordamt;
		private double _accamt;
		private string _cause;
		private string _pstatus;
		private double _hqty;
        private int? _listid;
		private string _spno;
		private double _adjqty;
		private double _adjppqty;
		private double _adjamt;
		
        /// <summary>
        /// 订单主键
        /// </summary>
		public string Plistid
		{
			get { return _plistid;	 }
			set { _plistid=value;	}
		}
        /// <summary>
        /// 商品主键
        /// </summary>
		public string Pdlistid
		{
			get { return _pdlistid;	 }
			set { _pdlistid=value;	}
		}
        /// <summary>
        /// 预退数量
        /// </summary>
		public double Bqty
		{
			get { return _bqty;	 }
			set { _bqty=value;	}
		}
        /// <summary>
        /// 实退数量
        /// </summary>
		public double Accqty
		{
			get { return _accqty;	 }
			set { _accqty=value;	}
		}
        /// <summary>
        /// 预退价
        /// </summary>
		public double Price
		{
			get { return _price;	 }
			set { _price=value;	}
		}
        /// <summary>
        /// 实退价格
        /// </summary>
		public double Rprice
		{
			get { return _rprice;	 }
			set { _rprice=value;	}
		}
        /// <summary>
        /// 预退金额
        /// </summary>
		public double Ordamt
		{
			get { return _ordamt;	 }
			set { _ordamt=value;	}
		}
        /// <summary>
        /// 实退金额
        /// </summary>
		public double Accamt
		{
			get { return _accamt;	 }
			set { _accamt=value;	}
		}
        /// <summary>
        /// 退货原因
        /// </summary>
		public string Cause
		{
			get { return _cause;	 }
			set { _cause=value;	}
		}
        /// <summary>
        /// 退货商品状态
        /// </summary>
		public string Pstatus
		{
			get { return _pstatus;	 }
			set { _pstatus=value;	}
		}
        /// <summary>
        /// 损坏数量
        /// </summary>
		public double Hqty
		{
			get { return _hqty;	 }
			set { _hqty=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public int? Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public string Spno
		{
			get { return _spno;	 }
			set { _spno=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjqty
		{
			get { return _adjqty;	 }
			set { _adjqty=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjppqty
		{
			get { return _adjppqty;	 }
			set { _adjppqty=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjamt
		{
			get { return _adjamt;	 }
			set { _adjamt=value;	}
		}
		
		public static List<Ord4a01> GetOrd4a01ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Ord4a01> list = new List<Ord4a01>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Ord4a01 model = GetOrd4a01ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Ord4a01 GetOrd4a01ByDataRow(DataRow dr)
		{
			Ord4a01 model = new Ord4a01(); //实例化Ord4a01
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("plistid")&&!(dr["plistid"] is System.DBNull))  
				model.Plistid = ( string)dr["plistid"];
			if (dcc.Contains("pdlistid")&&!(dr["pdlistid"] is System.DBNull))  
				model.Pdlistid = ( string)dr["pdlistid"];
			if (dcc.Contains("bqty")&&!(dr["bqty"] is System.DBNull))  
				model.Bqty = Convert.ToDouble(dr["bqty"]);
			if (dcc.Contains("accqty")&&!(dr["accqty"] is System.DBNull))  
				model.Accqty = Convert.ToDouble(dr["accqty"]);
			if (dcc.Contains("price")&&!(dr["price"] is System.DBNull))  
				model.Price = Convert.ToDouble(dr["price"]);
			if (dcc.Contains("rprice")&&!(dr["rprice"] is System.DBNull))  
				model.Rprice = Convert.ToDouble(dr["rprice"]);
			if (dcc.Contains("ordamt")&&!(dr["ordamt"] is System.DBNull))  
				model.Ordamt = Convert.ToDouble(dr["ordamt"]);
			if (dcc.Contains("accamt")&&!(dr["accamt"] is System.DBNull))  
				model.Accamt = Convert.ToDouble(dr["accamt"]);
			if (dcc.Contains("cause")&&!(dr["cause"] is System.DBNull))  
				model.Cause = ( string)dr["cause"];
			if (dcc.Contains("pstatus")&&!(dr["pstatus"] is System.DBNull))  
				model.Pstatus = ( string)dr["pstatus"];
			if (dcc.Contains("hqty")&&!(dr["hqty"] is System.DBNull))  
				model.Hqty = Convert.ToDouble(dr["hqty"]);
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( int)dr["listid"];
			if (dcc.Contains("spno")&&!(dr["spno"] is System.DBNull))  
				model.Spno = ( string)dr["spno"];
			if (dcc.Contains("adjqty")&&!(dr["adjqty"] is System.DBNull))  
				model.Adjqty = Convert.ToDouble(dr["adjqty"]);
			if (dcc.Contains("adjppqty")&&!(dr["adjppqty"] is System.DBNull))  
				model.Adjppqty = Convert.ToDouble(dr["adjppqty"]);
			if (dcc.Contains("adjamt")&&!(dr["adjamt"] is System.DBNull))  
				model.Adjamt = Convert.ToDouble(dr["adjamt"]);
			
			return model;
		}
    }
}
